package com.brainstore.patterns.factorymethod;

import org.w3c.dom.Document;

import java.io.File;

/**
 * BRAIN-STORE PROJECT.
 * <p/>
 * User: Sasha
 * Date: 23.03.12
 * Time: 23:32
 */
public class FactoryMethod {
    public static AbstractWriter getWriter(Object object) {
        AbstractWriter writer = null;
        if (object instanceof File) {
            writer = new ConcreteFileWriter();
        } else if (object instanceof Document) {
            writer = new ConcreteXmlWriter();
        }
        return writer;
    }
}
